Using the web to predict regional trade flows: material and immaterial regional interdependencies


Emmanouil Tranos, Andre Carrascal Incera & George Willis

University of Bristol, Alan Turing Institute
, @EmmanouilTranos, etranos.info

Contents

  • Introduction
  • Web data and spatial research
  • Empirical strategy
  • Descriptive statistics
  • Results
  • Conclusions

    etranos.info/post/sad2021

Introduction

Regional trade flows

  • Regions are more specialised and open than countries
  • Regions are more open to trade with other regions in comparison to national economies
  • Important external trade dependencies
  • Regions vary a lot in terms of their specialisation patterns, trade relationships and openness

Regional trade flows

  • Knowing and predicting regional trade helps to understand:
    • regional economic performance
    • exposure to external shocks
    • place-based development
  • Employment vulnerability and transmission of internal and external shocks is different for different regions.
  • Workers in regions in the US with a specialisation in specific manufacturing industries were more vulnerable for the emergence of China (Autor et al. 2013)

Regional trade flow: hardly any data

  • Big caveat: interregional trade data
  • Europe: spatially disaggregated IO for NUTS2 regions (Thissen, Diodato, and Van Oort 2013b, 2013a)
  • Costly, difficult exercise

Our contribution

  • Utilise the digital traces that interregional trade leaves behind
  • Model and predict trade flows for the UK NUTS2 regions
  • Scrape open web data
  • Hyperlinks between commercial websites
  • ML techniques for predictions of unseen interregional trade flows
  • Hypothesis: such hyperlinks reflect business and trade relations

Web data and spatial research

Web data and business studies

  • Businesses may not expose all of their strategies on their websites, but neither do they do during surveys (Arora et al. 2013)
  • Business websites:
    • spreading information
    • establishing a public image
    • supporting online transactions
    • sharing opinions

Empirical strategy

Web data: The Internet Archive

  • The largest archive of webpages in the world
  • 273 billion webpages from over 361 million websites, 15 petabytes of storage (1996 -)
  • A web crawler starts with a list of URLs (a seed list) to crawl and downloads a copy of their content
  • Using the hyperlinks included in the crawled URLs, new URLs are identified and crawled (snowball sampling)
  • Time-stamp

Web data: The Internet Archive

Web data: The Internet Archive

Our web data

  • JISC UK Web Domain Dataset: all archived webpages from the .uk domain 1996-2010
  • Curated by the British Library
  • Tranos, E., and C. Stich. 2020. Individual internet usage and the availability of online content of local interest: A multilevel approach. Computers, Environment and Urban Systems, 79:101371
  • Tranos, E., T. Kitsos, and R. Ortega-Argilés, R. 2020 Digital economy in the UK: Regional productivity effects of early adoption. Regional Studies, in press

Our web data

  1. All .uk archived webpages which contain a UK postcode in the web text

  2. Hyperlinks

Modelling strategy

\[trade_{ij,t} \sim hyperlinks_{ij,t} + distance_{ij} + \\ pop.density_{i,t} + pop.density_{i,t} + empl_{i,t} + empl_{j,t} \]

  • Predict inter-regional trade flows using Random Forests (RF)
  • Trade flow data from Thissen, Diodato, and Van Oort (2013b) and Thissen, Diodato, and Van Oort (2013a)
  • RF: tree-based ensemble learning method (Breiman 2001)
  • Classification and regression problems (Biau 2012)
  • Creates random samples of the training data, which are then used to grow an equivalent number of regression trees to predict the dependent variable
  • Decision trees are trained in parallel
  • To make a prediction for regression problems, RF average the predictions of all decision trees

Modelling strategy: Random Forests

  • Can handle skewed distributions and outliers
  • Avoid overfitting
  • Effectively model non-linear relationships
  • Small number of hyperparameters that need to be tuned, low sensitivity
  • Short training time (Caruana, Karampatziakis, and Yessenalina 2008; Liaw, Wiener, and others 2002; Yan, Liu, and Zhao 2020)
  • Current economic thinking advocates towards the use of ML algorithm such as RF
  • Outperform OLS in out-of-sample predictions even when using moderate size training datasets and limited number of predictors (Mullainathan and Spiess 2017; Athey and Imbens 2019)

Modelling strategy: rolling forecasting

  • Train RF models on data from years \(t\) and \(t + 1\) to increase the size of the training dataset
  • 10-fold cross validation
  • Predict unseen data from year \(t + 2\)
  • No data pooling to maintain their temporal structure both for methodological and conceptual reasons
  • No data leakage

Modelling strategy: predictive performance

\[\begin{align} R^2 = 1 - \frac{\sum_{k} (y_{k} - \hat{y_{k}})^2} {\sum_{k} (y_{k} - \overline{y_{k}})^2} \label{eq:rsquared} \end{align}\]

\[\begin{align} MAE = \frac{1}{N} \sum_{k = 1}^{N} |\hat{y_{k}} - y_{k}| \label{eq:mae} \end{align}\]

\[\begin{align} RMSE = \sqrt{\frac{\sum_{k = 1}^{N} (\hat{y_{k}} - y_{k})^2} {N}} \label{eq:rmse} \end{align}\]

  • Larger errors carry more weight for \(RMSE\)

Data cleaning

Unique postcodes frequencies, 2000

level freq perc cumfreq cumperc
(0,1] 41596 0.718 41596 0.718
(1,2] 6451 0.111 48047 0.830
(2,10] 6163 0.106 54210 0.936
(10,100] 2975 0.051 57185 0.988
(100,1000] 646 0.011 57831 0.999
(1000,10000] 62 0.001 57893 1.000
(10000,100000] 4 0.000 57897 1.000
  • Websites with a large number of postcodes: e.g. directories, real estate websites
  • \(2\) samples: Websites with \(1\) vs. up to \(10\) unique postcodes

Directory website with a lot of postcodes

Website with a unique postcode in London

Desctiptive statistics

Interregional trade flows

Correlations with interregional trade

year hyperlinks distance
2000 0.539 -0.219
2001 0.578 -0.221
2002 0.793 -0.221
2003 0.483 -0.220
2004 0.807 -0.223
2005 0.643 -0.219
2006 0.585 -0.219
2007 0.598 -0.214
2008 0.491 -0.205
2009 0.922 -0.207
2010 0.674 -0.205

Results

Modelling strategy

\[trade_{ij,t} \sim hyperlinks_{ij,t} + distance_{ij} + \\ pop.density_{i,t} + pop.density_{i,t} + empl_{i,t} + empl_{j,t} \]

  • Rolling forecasting
  • Train RF models on data from years \(t\) and \(t + 1\)
  • 10-fold cross validation
  • Predict unseen data from year \(t + 2\)

Train on year t and t + 1

Feature importance

Test on t + 2

year RMSE Rsquared MAE
2002 937.93 0.96 159.87
2003 1360.28 0.94 244.75
2004 1014.83 0.95 179.15
2005 1790.07 0.89 304.86
2006 1706.73 0.92 309.16
2007 1920.11 0.91 210.23
2008 1558.92 0.92 233.35
2009 1353.12 0.93 202.70
2010 3170.16 0.63 303.68

Test on t + 2

Alternative specifications

Sectoral decombosition

Code Industry name
s1 Agriculture
s2 Mining, quarrying and energy supply
s3 Food beverages and tobacco
s4 Textiles and leather etc.
s5 Coke, refined petroleum, nuclear fuel and chemicals etc.
s6 Electrical and optical equipment and transport equipment
s8 Other manufacturing
s9 Construction
s10 Distribution
s11 Hotels and restaurant
s12 Transport storage and communication
s13 Financial intermediation
s14 Real estate renting and business activities
s15 Non-Market Services

Sectoral decombosition

Sectoral decombosition

  • Higher accuracy in trade of goods (\(s1\)-\(s8\)) than services (\(s10\)-\(s15\))
  • Drop in prediction accuracy in \(2010\) for services sectors (\(s10\)-\(s15\)) due to the financial crisis and the knock on effects
  • The decrease of interregional trade volume makes it more difficult to predict
  • Hotels and Restaurants (\(s11\)): the most difficult sector to predict because of strong intraregional trade dependencies

Robustness check: websites with up to 10 postcodes (larger sample)

year RMSE Rsquared MAE
2002 1181.91 0.94 244.27
2003 1428.99 0.93 282.77
2004 1011.14 0.95 173.31
2005 1414.77 0.94 232.25
2006 1433.92 0.94 208.32
2007 1894.59 0.91 227.77
2008 1206.30 0.95 249.66
2009 2008.83 0.81 238.38
2010 2500.10 0.78 298.27

Conclusions

  • Interregional trade is important to know about…
  • … but very difficult to capture
  • Current state-of-the art: distance decay
  • Interregional trade increasingly leaves behind digital paper trail
  • Highly accurate prediction framework
  • Sectorally disaggregated
  • Opportunity for more spatially disaggregated trade studies

RSA: Regions in Recovery: Building Sustainable Futures – Global E-Festival

Call for papers: SS12. Digital tools for the recovery and the resilience of cities and regions during and after a crisis

- How do crises (including but not limited to the current pandemic) affect digitisation processes at various geographical levels?

- What is the impact of broadband supply characteristics in mitigating negative shocks?

- How can policy effectively use digitisation as a resilience and recovery tool?

- What are the socio-economic consequences of digital connectivity divides?

- What is the relationship between digital connectivity and wellbeing?

Abstract submission deadline: 17th March 2021: https://www.regionalstudies.org/events/rinr2021/

References

Athey, Susan, and Guido W Imbens. 2019. “Machine Learning Methods That Economists Should Know About.” Annual Review of Economics 11: 685–725.

Biau, GÊrard. 2012. “Analysis of a Random Forests Model.” Journal of Machine Learning Research 13 (Apr): 1063–95.

Breiman, Leo. 2001. “Random Forests.” Machine Learning 45 (1): 5–32.

Caruana, Rich, Nikos Karampatziakis, and Ainur Yessenalina. 2008. “An Empirical Evaluation of Supervised Learning in High Dimensions.” In Proceedings of the 25th International Conference on Machine Learning, 96–103. ICML ’08. New York, NY, USA: Association for Computing Machinery. https://doi.org/10.1145/1390156.1390169.

Halavais, Alexander. 2000. “National Borders on the World Wide Web.” New Media & Society 2 (1): 7–28.

Holmberg, Kim. 2010. “Co-Inlinking to a Municipal Web Space: A Webometric and Content Analysis.” Scientometrics 83 (3): 851–62.

Holmberg, Kim, and Mike Thelwall. 2009. “Local Government Web Sites in Finland: A Geographic and Webometric Analysis.” Scientometrics 79 (1): 157–69.

Janc, Krzysztof. 2015. “Geography of Hyperlinks—Spatial Dimensions of Local Government Websites.” European Planning Studies 23 (5): 1019–37.

Jones, Brant W, Ben Spigel, and Edward J Malecki. 2010. “Blog Links as Pipelines to Buzz Elsewhere: The Case of New York Theater Blogs.” Environment and Planning B: Planning and Design 37 (1): 99–111.

Keßler, Carsten. 2017. “Extracting Central Places from the Link Structure in Wikipedia.” Transactions in GIS 21 (3): 488–502.

Krüger, Miriam, Jan Kinne, David Lenz, and Bernd Resch. 2020. “The Digital Layer: How Innovative Firms Relate on the Web.” ZEW-Centre for European Economic Research Discussion Paper, nos. 20-003.

Liaw, Andy, Matthew Wiener, and others. 2002. “Classification and Regression by randomForest.” R News 2 (3): 18–22.

Lin, Jia, Alexander Halavais, and Bin Zhang. 2007. “The Blog Network in America: Blogs as Indicators of Relationships Among Us Cities.” Connections 27 (2): 15–23.

Mullainathan, Sendhil, and Jann Spiess. 2017. “Machine Learning: An Applied Econometric Approach.” Journal of Economic Perspectives 31 (2): 87–106.

Salvini, Marco M, and Sara I Fabrikant. 2016. “Spatialization of User-Generated Content to Uncover the Multirelational World City Network.” Environment and Planning B: Planning and Design 43 (1): 228–48.

Thissen, M, D Diodato, and F Van Oort. 2013a. “European Regional Trade Flows: An Update for 2000–2010.” PBL Netherlands Environmental Assessment Agency, the Hague.

———. 2013b. “Integrated Regional Europe: European Regional Trade Flows in 2000.” PBL Netherlands Environmental Assessment Agency, the Hague.

Vaughan, Liwen. 2004. “Exploring Website Features for Business Information.” Scientometrics 61 (3): 467–77.

Yan, Xiang, Xinyu Liu, and Xilei Zhao. 2020. “Using Machine Learning for Direct Demand Modeling of Ridesourcing Services in Chicago.” Journal of Transport Geography 83: 102661.